Drop gtk_init_with_args
authorMatthias Clasen <mclasen@redhat.com>
Tue, 27 Dec 2016 23:31:03 +0000 (18:31 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Thu, 19 Jan 2017 18:21:12 +0000 (13:21 -0500)
We want to simplify our initialization code and remove all commandline
argument handling from it. The first stop for this is to reduce the
number of gtk_init variants we have.

gtk/gtkmain.c
gtk/gtkmain.h

index c9b91b2aedfbe635fafbdfd250990d5ab337201f..97f0144b98857c2cbcf8414e7415d08a2d245100 100644 (file)
@@ -902,83 +902,6 @@ gtk_get_option_group (gboolean open_default_display)
   return group;
 }
 
-/**
- * gtk_init_with_args:
- * @argc: (inout): Address of the `argc` parameter of
- *     your main() function (or 0 if @argv is %NULL). This will be changed if 
- *     any arguments were handled.
- * @argv: (array length=argc) (inout) (allow-none): Address of the
- *     `argv` parameter of main(), or %NULL. Any options
- *     understood by GTK+ are stripped before return.
- * @parameter_string: (allow-none): a string which is displayed in
- *    the first line of `--help` output, after
- *    `programname [OPTION...]`
- * @entries: (array zero-terminated=1): a %NULL-terminated array
- *    of #GOptionEntrys describing the options of your program
- * @translation_domain: (nullable): a translation domain to use for translating
- *    the `--help` output for the options in @entries
- *    and the @parameter_string with gettext(), or %NULL
- * @error: a return location for errors
- *
- * This function does the same work as gtk_init_check().
- * Additionally, it allows you to add your own commandline options,
- * and it automatically generates nicely formatted
- * `--help` output. Note that your program will
- * be terminated after writing out the help output.
- *
- * Returns: %TRUE if the windowing system has been successfully
- *     initialized, %FALSE otherwise
- *
- * Since: 2.6
- */
-gboolean
-gtk_init_with_args (gint                 *argc,
-                    gchar              ***argv,
-                    const gchar          *parameter_string,
-                    const GOptionEntry   *entries,
-                    const gchar          *translation_domain,
-                    GError              **error)
-{
-  GOptionContext *context;
-  GOptionGroup *gtk_group;
-  gboolean retval;
-
-  if (gtk_initialized)
-    goto done;
-
-  gettext_initialization ();
-
-  if (!check_setugid ())
-    return FALSE;
-
-  gtk_group = gtk_get_option_group (FALSE);
-
-  context = g_option_context_new (parameter_string);
-  g_option_context_add_group (context, gtk_group);
-  g_option_context_set_translation_domain (context, translation_domain);
-
-  if (entries)
-    g_option_context_add_main_entries (context, entries, translation_domain);
-  retval = g_option_context_parse (context, argc, argv, error);
-
-  g_option_context_free (context);
-
-  if (!retval)
-    return FALSE;
-
-done:
-  if (gdk_display_open_default () != NULL)
-    {
-      if (gtk_get_debug_flags () & GTK_DEBUG_INTERACTIVE)
-        gtk_window_set_interactive_debugging (TRUE);
-
-      return TRUE;
-    }
-
-  return FALSE;
-}
-
-
 /**
  * gtk_parse_args:
  * @argc: (inout): a pointer to the number of command line arguments
index 3dfcc6c12e88b64196358ccf7b7f9c634e888aca..475439516996a6873ff4fd64458a76dbd4b4ae71 100644 (file)
@@ -84,14 +84,6 @@ GDK_AVAILABLE_IN_ALL
 gboolean gtk_init_check           (int    *argc,
                                    char ***argv);
 
-GDK_AVAILABLE_IN_ALL
-gboolean gtk_init_with_args       (gint                 *argc,
-                                   gchar              ***argv,
-                                   const gchar          *parameter_string,
-                                   const GOptionEntry   *entries,
-                                   const gchar          *translation_domain,
-                                   GError              **error);
-
 GDK_AVAILABLE_IN_ALL
 GOptionGroup *gtk_get_option_group (gboolean open_default_display);